package com.ruoyi;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.transaction.annotation.EnableTransactionManagement;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

/**
 * 启动程序
 * 
 * @author ruoyi
 */
@SpringBootApplication
@EnableTransactionManagement
@EnableScheduling
@MapperScan("com.ruoyi.project.*.*.mapper")
public class RuoYiApplication extends SpringBootServletInitializer {

    public static void main(String[] args) throws IOException {
        // 程序启动入口
        Properties properties = new Properties();
        InputStream in = RuoYiApplication.class.getClassLoader().getResourceAsStream("application.yml");
        properties.load(in);
        SpringApplication app = new SpringApplication(RuoYiApplication.class);
        app.setDefaultProperties(properties);
        app.run(args);

        /*EmbeddedServletContainerAutoConfiguration*/

    }

    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
        // TODO Auto-generated method stub
        builder.sources(this.getClass());
        return super.configure(builder);
    }

}